package net.nagaseyasuhito.nicola;

import org.apache.wicket.Application;
import org.apache.wicket.Component;
import org.apache.wicket.application.IComponentOnBeforeRenderListener;
import org.apache.wicket.guice.GuiceComponentInjector;

import com.google.inject.Injector;
import com.google.inject.Module;

/**
 * GuiceComponentInjectorにIComponentOnBeforeRenderListenerを実装。
 * すべての@InjectしてあるプロパティをRequestごとに(厳密にはonBeforeRenderが呼ばれたタイミングで)injectします。
 * @author NAGASEYASUHiTO
 */
public class NicolaGuiceComponentInjector extends GuiceComponentInjector implements IComponentOnBeforeRenderListener {

	public NicolaGuiceComponentInjector(Application app) {
		super(app);
	}

	public NicolaGuiceComponentInjector(Application app, Module ... modules) {
		super(app, modules);
	}

	public NicolaGuiceComponentInjector(Application app, Injector injector) {
		super(app, injector);
	}

	@Override
	public void onBeforeRender(Component component) {
		this.inject(component);
	}
}
